Program development typically follows a cycle of writing source code, editing the source code, compiling the source code, and then executing the resulting binary code. The development cycle may occur in various computing environments ranging, for example, from an individual developer's computer to a system of computing devices that includes the developer's computer, intermediate computers, and an enterprise of deployment computers interconnected through one or more networks. Thus, the cycle may also include intermediate stages that involve, for example, the installation and execution of the program on an intermediate computer prior to the installation and execution of the program on final deployment computers.
There are various reasons why a program might need to be transformed at some point throughout its development cycle. For example, there may be a need to introduce code into a program to monitor its execution and determine whether it is running correctly. Such “watchdog” code might perform tasks such as counting the number of times a particular function is called or sending the output of a particular function to a file. If a problem is discovered in the execution of a program, there may be a need to further transform the program to include additional code designed to discover the source of the problem.
Some programming languages support features that enable certain transformations such as the introduction of “watchdog” code. However, these transformation features are typically very limited. In addition, such features are typically implemented through compilers that are language-specific. Thus, one programming language may support a “watchdog” code transformation feature while another may not.
Other reasons for transforming a program during development might include the varying execution environments in which the program will be deployed. For example, a program may run as part of an operating system, a database, or an application program. The semantics, or defined system behaviors, may vary from one environment to another, or they may vary within an environment when the environment changes (e.g., an operating system upgrade). Thus, a program may behave differently in different and changing environments. Therefore, ensuring that a program performs in a consistent manner in different environments may require a program transformation. Such transformations can be achieved by the developer introducing environment-specific code into the source, or by introducing such code through the compiler. Another option is to transform the execution environment. Each of these options has the disadvantage of significantly increasing the complexity of either the program, the compiler, or the execution environment.
Accordingly, there is a need for a way to implement code transformations at different stages throughout the development and deployment cycle of a program that does not significantly increase the complexity of the source program, compiler, or execution environment.